<?php
class Application_Form_Signup extends Zend_Form
{
	public function init()
	{
		$this->setMethod(self::METHOD_POST);
		$this->setAction('/account/register');
		//add the various form elements
		//TODO add more validators
        $this->addElement('text', 'fname', array(
            'label'      => 'First Name:',
            'required'   => true,
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 20))
                )
        ));
        $this->addElement('text', 'lname', array(
            'label'      => 'Last Name:',
            'required'   => true,
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 20))
                )
        ));
        $this->addElement('text', 'alias', array(
            'label'      => 'Alias:',
            'required'   => true,
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 20))
                )
        ));
        $this->addElement('password', 'password', array(
            'label'      => 'Password:',
            'required'   => true,
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 20))
                )
        ));
		$this->addElement('text', 'email', array(
            'label'      => 'Email:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'EmailAddress',
            )
        ));
        $this->addElement('captcha', 'captcha', array(
            'label'      => 'Please enter the letters displayed below:',
            'required'   => true,
            'captcha'    => array(
                'captcha' => 'Image',
                'wordLen' => 5,
                'timeout' => 120,
        		'imgDir' => APPLICATION_PATH.'/../public/captcha/images',
				'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl().'/captcha/images',
        		'font' => APPLICATION_PATH.'/../public/captcha/fonts/arial.ttf',
            )
        ));
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Create my account',
        ));
        $this->addElement('hash', 'csrf', array(
            'ignore' => true,
        ));
	}
}